﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BookStore.Data;
using System.Data;

namespace BookStore.Bussiness
{
    public class productService
    {
       
        #region getbyID
        public static productInfo getbyID(int productID)
        {
            return productController.getbyID(productID);
        }
        #endregion

        #region getAll
        public static DataTable getAll() {
            return productController.ListProduct();
        }
        #endregion

        #region insert
        public static bool insertProduct(productInfo objProduct) {
            return productController.insertProduct(objProduct);
        }
        #endregion

        #region update
        public static bool updateProduct(productInfo objProduct) {
            return productController.updateProduct(objProduct);
        }
        #endregion

        #region delete
        public static bool deleteProduct(int productID) {
            return productController.deleteProduct(productID);
        }
        #endregion

        productController pr = new productController();

        public productInfo getById(int id)
        {
            return pr.getById(id);
        }
        public DataTable getByIdReturnDataTable(int id)
        {
            return pr.getByIdReturnDataTable(id);
        }

        public static DataTable Top_productBestsellers() 
        {
            return productController.Top_productBestsellers();
        }
       
      


        #region checkProuctID
        //public static bool checkProductID(string productID) {
        //    return productController.checkProductID(productID);
        //}
        #endregion


        public static  DataTable Get_ProductAsTable(string whereSql, string orderBy) 
        {
         
            if (string.IsNullOrEmpty(whereSql)) whereSql = "";
            if (string.IsNullOrEmpty(orderBy)) orderBy = "";
            return productController.Get_ProductAsTable(whereSql, orderBy);
        }
        public static DataTable Get_productname(string name) 
        {
            return productController.Get_productname(name);
        }
        public static DataTable Get_productnamewithcata(string cat, string name) 
        {
            return productController.Get_productnamewithcata(cat, name);
        }
        public static DataTable New_product() { return productController.New_product(); }

        public string ProductName(productInfo pro)
        {
            return pr.ProductName(pro);
        }
        //phuong thuc lay ve gia tien
        public float Price(productInfo pro)
        {
            return pr.Price(pro);
        }
        public static DataTable Top_productOLD() 
        {
            return productController.Top_productOLD();
        }
        public static DataTable Get_ProductNameLike() 
        {
            return productController.Get_ProductNameLike();
        }
        public static DataTable Get_ProductVPP() 
        {
            return productController.Get_ProductVPP();
        }
        public static DataTable FindIDcuswithproduct( string email) 
        {
            return productController.FindIDcuswithproduct(email);
        }
    }
}
